// import React from 'react'
// import { Button, Field, Form , Toast} from 'react-vant';
// import {useNavigate} from "react-router-dom"
// import {debounce} from "lodash"

// function Login() {
//   const [form] = Form.useForm();
//   const navigate = useNavigate()
//   const onFinish = (values) => {
//     console.log(values);
//     if (values.username  === "admin" && values.password === "123456") {
//       window.localStorage.setItem("user",JSON.stringify(values))
//       navigate("/")
//       Toast.success({message:"登陆成功"})
//     }else {
//       form.setFieldsValue({
//         username:"",
//         password:""
//       })
//       Toast.fail({message:"登陆失败"})
//     }
//   };
//   return (
//     <div>
//       <p>login</p>
//       <Form
//         form={form}
//         showValidateMessage={false}
//         onFinish={debounce(onFinish,2000)}
//         footer={
//           <div style={{ margin: '16px 16px 0' }}>
//             <Button round nativeType="submit" type="primary" block>
//               提交
//             </Button>
//           </div>
//         }
//       >
//         <Form.Item
//           tooltip={{
//             message:
//               'A prime is a natural number greater than 1 that has no positive divisors other than 1 and itself.',
//           }}
//           intro="确保这是唯一的用户名"
//           rules={[{ required: true, message: '请填写用户名' }]}
//           name="username"
//           label="用户名"
//         >
//           <Field placeholder="请输入用户名" />
//         </Form.Item>
//         <Form.Item rules={[{ required: true, message: '请填写密码' }]} name="password" label="密码">
//           <Field placeholder="请输入密码" />
//         </Form.Item>
//       </Form>
//     </div>
//   )
// }

// export default Login

import React, { useState } from 'react'
import {useNavigate} from "react-router-dom"
function Login() {
  const navigate = useNavigate()
  const [value,setValue] = useState("")
  const [value1,setValue1] = useState("")
  return (
    <div>
       用户明<input type="text"  value={value} onChange={(e)=>setValue(e.target.value)}/><br/>
        密码  <input type="text" value={value1} onChange={(e)=>setValue1(e.target.value)} /><br/>
        
        <button onClick={()=>{
          console.log(value,value1);
          window.localStorage.setItem("user",JSON.stringify({name:value,password:value1}))
          navigate("/")
        }}>denglu</button>
    </div>
  )
}

export default Login
